package com.kakastack.common.pagehelp.mock;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kakastack.common.pagehelp.dto.UserDTO;
import com.kakastack.common.pagehelp.entity.UserEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by alan on 2022/6/9.
 */
public class ResultMock {

    public final static IPage<String> mockPage() {
        Page page = new Page();
        page.setCurrent(1L);
        page.setSize(5);
        page.setTotal(10000);

        List<String> arrayList = new ArrayList();
        arrayList.add("A");
        arrayList.add("B");
        arrayList.add("C");
        arrayList.add("D");
        arrayList.add("E");
        page.setRecords(arrayList);
        return page;
    }

    public final static IPage<UserEntity> mockPageQuery() {

        Page page = new Page();
        page.setCurrent(1L);
        page.setSize(5);
        page.setTotal(10000);

        List<UserEntity> arrayList = mockUserEntities();
        page.setRecords(arrayList);
        return page;
    }

    public static List<UserEntity> mockUserEntities() {
        List<UserEntity> arrayList = new ArrayList();
        arrayList.add(UserEntity
                .builder()
                .name("A")
                .age("19")
                .build());
        arrayList.add(UserEntity
                .builder()
                .name("B")
                .age("199")
                .build());
        arrayList.add(UserEntity
                .builder()
                .name("C")
                .age("20")
                .build());
        arrayList.add(UserEntity
                .builder()
                .name("D")
                .age("18")
                .build());
        return arrayList;
    }

    public static List<UserDTO> mockUserDTOs() {
        List<UserDTO> arrayList = new ArrayList();
        arrayList.add(UserDTO
                .builder()
                .name("A")
                .build());
        arrayList.add(UserDTO
                .builder()
                .name("B")
                .build());
        arrayList.add(UserDTO
                .builder()
                .name("C")
                .build());
        arrayList.add(UserDTO
                .builder()
                .name("D")
                .build());
        return arrayList;
    }

}
